package com.jsm.tf.net.command;

import com.jsm.tf.director.Director;
import com.jsm.tf.net.message.response.LoginResponseMessage;
import com.jsm.tf.view.RoomListView;
import io.netty.channel.Channel;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class LoginResponseMessageCommand implements Command<LoginResponseMessage> {
    @Resource
    private Director director;
    @Override
    public void execute(LoginResponseMessage message, Channel channel) {
        if(message.getUser()!=null){
            director.setUser(message.getUser());
            director.showView(RoomListView.class);
        }

    }
}
